package riofrio;

import java.util.Iterator;
import riofrio.TreeNode;
import riofrio.AbstractTreeWalk;

/**
 * A walk where nodes are visited by level.  First, root, then children of root, the grand children of root, etc...
 * 
 * @author Victor Hugo Herrera Maldonado
 */
public class BreadthFirstWalk<T> extends AbstractTreeWalk<T>{

    /**
     * Create an instance of the walk for the specified node.
     * 
     * @param node Node to walk.
     */
    public BreadthFirstWalk(TreeNode<T> node) {
        super(node);
    }

    @Override
    public Iterator<TreeNode<T>> iterator() {
        return new BreadthFirstWalkIterator<>(getNode());
    }

}
